Release 10.1A: OpenEdge Data Management:
SQL Reference
SQLCursor.getValue
Assigns a single value from an SQL result set to a procedure variable. The single field value is the result of an SQL query or the result from another stored procedure.
Format
public Object getValue( intfieldNum, shortfieldType)Returns
Object
Parameters
fieldNumAn integer that specifies the position of the field to retrieve from the fetched record.
fieldTypeA short integer that specifies the data type of the parameter. The allowable defined values for
fieldTypeare listed in Table 56, grouped by category of data type.
Throws
DhSQLExceptionNotes
Example
- Before invoking
getValue, you must test for theNULLcondition by calling theSQLCursor.wasNULLmethod. If the value returned isNULL, you must explicitly set the target variable in the stored procedure toNULL.- The
getValuemethod returns a value from the result set identified by the number you specify in thefieldNumparameter.getValuereturns the value as an object of the data type you specify in thefieldTypeparameter. SincegetValuereturns the result as an instance of class Object, you must explicitly cast your return value to the correct data type.- If the returned value is of data type
CHARACTER, thengetValuereturns a JavaStringObject. You must declare a procedure variable of typeStringand explicitly cast the value returned by getValue to typeString.This example illustrates testing for
NULLand invoking the JavagetValuemethod:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |